package Lee_code;

/**
 * @author blh
 * @date 2024年06月21日 10:44
 */
public class Lee_3 {
    public int lengthOfLongestSubstring(String s) {
        int len = s.length();
        char[] in = s.toCharArray();
        int slow = 0, fast = 1;
        int maxLen = 0;
        while (fast<len){
            String sub = s.substring(slow, fast);
            // s有这个数
            if (sub.indexOf(in[fast])!=-1){
                maxLen = Math.max(sub.length(), maxLen);
                slow = fast;
            }
            fast ++;
        }
        return maxLen;
    }
}
